import request from '~/utils/request'

const API_NAME = '/web/user/orders/auth'

export default {
  // 新增一个订单
  insert(courseId) {
    return request({
      url: `${API_NAME}/${courseId}`,
      method: 'post'
    })
  },
  // 根据ID获取一个订单
  queryById(orderId) {
    return request({
      url: `${API_NAME}/${orderId}`,
      method: 'get'
    })
  },
  // 获取订单支付状态
  isPaid(courseId) {
    return request({
      url: `${API_NAME}/paid/${courseId}`,
      method: 'get'
    })
  },
  // 修改订单支付状态
  update(orderNo) {
    return request({
      url: `${API_NAME}/${orderNo}`,
      method: 'put'
    })
  }
}
